<?php 
include 'includes/inc_header_list.php';
include 'includes/inc_header.php';
include 'includes/inc_menu.php'; 
?>
<div id='cols' class='box'>
	<?php include 'includes/left-column.php'; ?>
</div>
<hr class='noscreen' />
<div id='content' class='box'>
    <h1>Galeria de Animais</h1>
    <div class='pagination box'>
      <?php
          $imagem    = glob('uploads/*.*');
          $qtd       = 5;
          $atual     = (isset($_GET['pg'])) ? intval($_GET['pg']): 1;
          $pagArq    = array_chunk($imagem, $qtd);

          $contar    = count($pagArq);
          $resultado = $pagArq[$atual-1];
          for ($i = 1; $i < $contar; $i++){
        ?>
        <p class='f-right'>
           <?php
            if($i == $atual){
              echo "<a href='#'>&raquo;</a>";
            printf("<p class='f-right'><a href='#'  class='pagination-active'>%s</a></p>", $i);
          }
          else{
            echo "  <a href='#'>&laquo;</a>";
            printf("<a href='#'> %s </a>", $i);
          }

          ?>
        </p>
        <?php } ?>
        <p class='f-left'>Mostrando <strong>10&ndash;20</strong> de <strong>3 520</strong> resultados</p>
       
    </div> <!-- /pagination -->
     <?php include 'includes/inc_galeria_acao.php'; ?>

    <form action='#' method='post'>
        <div class='gallery'>

            <ul>
                <?php
                
                $imagem    = glob('uploads/*.*');
                $qtd       = 5;
                $atual     = (isset($_GET['pg'])) ? intval($_GET['pg']): 1;
                $pagArq    = array_chunk($imagem, $qtd);

                $contar    = count($pagArq);
                $resultado = $pagArq[$atual-1];
                
                require 'Model/Animal.php';
                require 'Model/DAO/AnimalDAO.php';
                
                $animalDAO = new AnimalDAO();

                foreach ($resultado as $valor) {
                   foreach ($animalDAO->getAllAnimal() as $linhas) {
                ?>
                    <li>
                      <label><code><?=$linhas['foto']?></code></label><br />
                      
                      <a href='tmp/img-01.gif' rel='lightbox' title='<?=$linhas['foto']?>'>
                      <img src='<?=$valor?>' width="116" class='gallery-img' alt='' /></a>
                    </li>
                <?php }  ?>
                <?php } ?>
            </ul>

        </div> <!-- /gallery -->
        <div class='fix'></div>
        <?php include 'includes/inc_galeria_acao.php'; ?>
            </form>
        </div>
        <hr class='noscreen' />
<?php include 'includes/inc_footer.php'; ?>